﻿using Basic.FormRemoteModel.PhysicalGroup;
using Basic.FormRemoteModel.PhysicalGroup.Model;
using Basic.FormService.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.Client.Interface;

namespace Basic.FormService.RpcEvent
{
    internal class PhysicaGroupEvent : IRpcApiService
    {
        private readonly IPhysicalGroupService _Service;

        public PhysicaGroupEvent ( IPhysicalGroupService service )
        {
            this._Service = service;
        }
        public void SetPhysicalGroupIsEnable ( SetPhysicalGroupIsEnable obj )
        {
            this._Service.SetIsEnable(obj.Id, obj.IsEnable);
        }
        public long AddPhysicalGroup ( AddPhysicalGroup obj )
        {
            return this._Service.Add(obj.Datum);
        }

        public void DeletePhysicalGroup ( DeletePhysicalGroup obj )
        {
            this._Service.Delete(obj.Id);
        }

        public PhyGroupData GetPhysicalGroup ( GetPhysicalGroup obj )
        {
            return this._Service.Get(obj.Id);
        }

        public PhyGroupItem[] GetPhysicalGroupItems ()
        {
            return this._Service.GetEnables();
        }

        public PagingResult<PhyGroupDto> QueryPhysicalGroup ( QueryPhysicalGroup query )
        {
            return this._Service.Query(query.Query, query.ToBasicPage());
        }

        public bool SetPhysicalGroup ( SetPhysicalGroup obj )
        {
            return this._Service.Set(obj.Id, obj.Datum);
        }
    }
}
